<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="com.psl.model.userlogin" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%userlogin user = (userlogin) session.getAttribute("user");%>
<%
    if (user == null) {
        response.sendRedirect("/login.do");
    }
%>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>欢迎页</title>
    <%--<link rel="stylesheet" type="text/css" href="/assets/css/metinfo.css">--%>
    <%--<link rel="stylesheet" type="text/css" href="/assets/css/newstyle.css">--%>
    <script src="/assets/js/echarts.js"></script>
</head>

<body>

<%if(user.getPosition_id()==1){%>
    <div id="main" style="width: 1000px;height:500px;"></div>
    <script type="text/javascript">
        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('main'));

        // 指定图表的配置项和数据
        var option = {
            title: {
                text: '暂收凭条今日入库动态监控'
            },
            tooltip: {},
            legend: {
                data:['数量']
            },
            xAxis: {
                data:[<c:forEach items="${today}" var="t" varStatus="status">"${t.h_name}${t.h_size}", </c:forEach>]
            },
            yAxis: {},
            series: [{
                name: '数量',
                type: 'bar',
                data: [<c:forEach items="${today}" var="t" varStatus="status">"${t.h_num}", </c:forEach>]
            }]
        };
        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
    </script>
<%}%>
</body>
</html>